<?php

namespace app\common\model;

use Carbon\Carbon;
use think\Model;

/**
 * 短信验证码
 */
class ApiToken extends Model
{

    // 追加属性
    protected $append = [
    ];

    public static function check($token)
    {
        $tokenModel = self::get($token);
        if (is_null($tokenModel)) {
            return false;
        }

        if (Carbon::now()->getTimestamp() > $tokenModel->expiretime) {
            return false;
        }

        return true;
    }

}
